import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'index',
      component: () => import('../views/HomeView.vue'),
      redirect: '/login',
      children: [
        {
          path: '/main',
          name: 'main',
          component: () => import('../views/main/Index.vue')
        },
        {
          path: '/about',
          name: 'about',
          // route level code-splitting
          // this generates a separate chunk (About.[hash].js) for this route
          // which is lazy-loaded when the route is visited.
          component: () => import('../views/AboutView.vue')
        }
        ,{
          path: '/dictType',
          name: 'dictType',
          component: () => import('../views/data/DictType.vue')
        },{
          path: '/dictData',
          name: 'dictData',
          component: () => import('../views/data/DictData.vue')
        },{
          path: '/checkFaceInfo',
          name: 'checkFaceInfo',
          component: () => import('../views/face/CheckFaceInfo.vue')
        },{
          path: '/addFaceInfo',
          name: 'addFaceInfo',
          component: () => import('../views/face/AddFaceInfo.vue')
        }
      ]

    },{
      path: '/login',
      name: 'login',
      component: () => import('../views/user/Login.vue')
    }
  ]
})

export default router
